home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / SDKs / FaxSTF™ Developers Kit 3.2 / FoxPro / FaxDemo.prg < prev    next >
Text File  |  1996-06-24  |  3KB  |  120 lines

  1.  
  2. *:main
  3. DO Initialization
  4. DO FaxSetup
  5. DO ProcessRecords
  6. DO FaxCleanUp
  7. DO HouseCleaning
  8. *:end main
  9.  
  10. *:*********************************************************************
  11. PROCEDURE Initialization
  12.  
  13. *: --- Initialize gloabal variables --- :*
  14. PUBLIC TRUE, FALSE, OrigionalHeader, anError, OldPrinter
  15. TRUE = "1"
  16. FALSE = "0"
  17. OrigionalHeader = TRUE
  18. anError = FALSE
  19. NewPrinter = "FaxPrint"
  20.  
  21. *: --- Setup the environment for speed gain --- :*
  22. SET TALK OFF
  23. SET DOHISTORY OFF
  24. SET OPTIMIZE ON
  25.  
  26. *: --- Prepare the necessary files --- :*
  27. SET EXCLUSIVE ON
  28. USE "FaxDemo.dbf"
  29. SET XCMDFILE TO "FoxPro Externals"
  30.  
  31. *: --- Load the necessary HyperCard XCMD resources --- :*
  32. LOAD "STFStartup"
  33. LOAD "STFAddDestinations"
  34. LOAD "STFShutDown"
  35. LOAD "STFdoSwitchPrinter"
  36. LOAD "STFdoSwitchToFaxPrint"
  37. LOAD "STFdoRestorePrinter"
  38. LOAD "STFdoScanSpoolFolder"
  39. LOAD "STFdoGetSoftwareState"
  40. LOAD "STFIsFaxSTFInstalled"
  41. LOAD "STFgetSTFDriverStatus"
  42.  
  43. RETURN
  44.  
  45. *:*********************************************************************
  46. PROCEDURE FaxSetup
  47.  
  48. *: --- Set the device to "FaxPrint" --- :*
  49. CALL "STFdoSwitchToFaxPrint" TO OldPrinter
  50.  
  51. *: --- CRITICAL: Turn off header/(page eject) --- :*
  52. SET HEADING OFF
  53.  
  54. RETURN
  55.  
  56. *:*********************************************************************
  57. PROCEDURE ProcessRecords
  58.  
  59. *: --- Goto the top of the .dbf file and read all records --- :*
  60. GOTO TOP
  61. LOCATE ALL
  62. DO WHILE !EOF()
  63.  
  64. *: --- Dump the record into an array --- :*
  65. SCATTER TO fieldArray
  66. coName         = fieldArray[1]
  67. faxNum         = fieldArray[2]
  68. voiceNum    = fieldArray[3]
  69. title         = fieldArray[4]
  70. sal            = fieldArray[5]
  71. firstName     = fieldarray[6]    
  72. lastName     = fieldArray[7]
  73. note        = fieldArray[8]
  74. autoDelete    = fieldArray[9]
  75. delay        = fieldArray[10]
  76. coverPg        = fieldArray[11]
  77. callGroup    = fieldArray[12]
  78. faxArchive    = fieldArray[13]
  79. wholeName    = (ALLTRIM(firstName) + ' ' + ALLTRIM(lastName))
  80.  
  81.  
  82. *: --- Create the 'destinations' file --- :*
  83. CALL "STFStartup" WITH note,delay,autoDelete,callGroup,coverPg,TRIM(faxArchive) TO anError                    
  84.  
  85. *: --- If a 'destinations' file was created....send the fax --- :*
  86. IF (anError = FALSE)
  87. CALL "STFAddDestinations" WITH TRIM(coName),faxNum,voiceNum,TRIM(firstName),TRIM(lastName),TRIM(sal)                             
  88. TYPE "FaxDemo.txt" TO PRINTER
  89. CALL "STFShutDown"
  90. ENDIF
  91.  
  92. *: --- Read the next record --- :*
  93. CONTINUE
  94. ENDDO 
  95.  
  96. RETURN
  97.  
  98. *:*********************************************************************
  99. PROCEDURE FaxCleanUp
  100.  
  101.  
  102. *: --- Set the printer back to the origional device --- :*
  103. CALL "STFdoRestorePrinter" TO anError
  104.         
  105. RETURN
  106.  
  107. *:*********************************************************************
  108. PROCEDURE HouseCleaning
  109.     
  110. *: --- Reset the file handling conditions --- :*
  111. SET EXCLUSIVE OFF
  112.  
  113. *: --- Clear the memory --- :*
  114. RELEASE ALL
  115.  
  116. *:+ whatever else you need to do…
  117.  
  118. RETURN
  119.  
  120.